package com.zfzs.post.modules.goods.repository;

import com.zfzs.post.modules.goods.domain.GoodOrderSn;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
* @author ck
* @date 2019-10-18
*/
public interface GoodOrderSnRepository extends JpaRepository<GoodOrderSn, Integer>, JpaSpecificationExecutor {
    //查询订单机器列表
    @Query(value = "select i.sn,IF(i.is_activation = 0,'未激活','已激活')as isActivation  from good_order_sn g " +
            "INNER JOIN post_terminal_info i ON i.sn = g.sn " +
            "where g.order_no = ?1 and g.channel_id = ?2", nativeQuery = true)
    List<Map<String,Object>> querySntByorderNoList(String orderNo, Long channelId);
}